﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace S4Store.Domain.NetMarketingKpi
{
    public class NetMarketingKpiYearReport
    {
        public NetMarketingKpiYearReport()
        {
            NetMarketingMonthDatas = new List<NetMarketingMonthData>();
        }

        public int Year { get; set; }
        public List<NetMarketingMonthData> NetMarketingMonthDatas { get; set; }

        /// <summary>
        /// 网站1月度费用
        /// </summary>
        public decimal AVG_WZ1YDFY
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1YDFY);
            }
        }

        /// <summary>
        /// 网站1获取信息数
        /// </summary>
        public decimal AVG_WZ1HQXXS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1HQXXS);
            }
        }
        /// <summary>
        /// 网站1来电数
        /// </summary>
        public decimal AVG_WZ1LDS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1LDS);
            }
        }

        /// <summary>
        /// 网站1获取资源总数
        /// </summary>
        public decimal AVG_WZ1ZYZS
        {
            get
            {
                return AVG_WZ1HQXXS + AVG_WZ1LDS;
            }
        }

        /// <summary>
        /// 网站1费用占比
        /// </summary>
        public decimal AVG_WZ1FYZB
        {
            get
            {
                var zfy = NetMarketingMonthDatas.Sum(t => t.WLZJSJTRE);
                var wz1fy = NetMarketingMonthDatas.Sum(t => t.WZ1YDFY);
                if (zfy == 0) return 0;
                return wz1fy * 100 / zfy;
            }
        }

        /// <summary>
        /// 网站1费用占比
        /// </summary>
        public decimal AVG_WZ1DCZYCB
        {
            get
            {
                var fy = NetMarketingMonthDatas.Sum(t => t.WZ1YDFY);
                var zyzs = NetMarketingMonthDatas.Sum(t => t.WZ1HQXXS+t.WZ1LDS);
                if (fy == 0) return 0;
                return zyzs  / fy;
            }
        }

        /**/

        /// <summary>
        /// 网站1计划发帖数
        /// </summary>
        public decimal AVG_WZ1JHFTS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1JHFTS);
            }
        }
        /// <summary>
        /// 网站1实际发帖数
        /// </summary>
        public decimal AVG_WZ1SJFTS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1SJFTS);
            }
        }

        /// <summary>
        /// 网站1集客进度
        /// </summary>
        public decimal AVG_WZ1JKJD
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1JKJD);
            }
        }
        /// <summary>
        /// 网站1集客进度
        /// </summary>
        public decimal AVG_WZ1JKJDDiff
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ1JKJDDiff);
            }
        }







        /// <summary>
        /// 网站2月度费用
        /// </summary>
        public decimal AVG_WZ2YDFY
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2YDFY);
            }
        }

        /// <summary>
        /// 网站2获取信息数
        /// </summary>
        public decimal AVG_WZ2HQXXS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2HQXXS);
            }
        }
        /// <summary>
        /// 网站2来电数
        /// </summary>
        public decimal AVG_WZ2LDS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2LDS);
            }
        }

        /// <summary>
        /// 网站2获取资源总数
        /// </summary>
        public decimal AVG_WZ2ZYZS
        {
            get
            {
                return AVG_WZ2HQXXS + AVG_WZ2LDS;
            }
        }

        /// <summary>
        /// 网站2费用占比
        /// </summary>
        public decimal AVG_WZ2FYZB
        {
            get
            {
                var zfy = NetMarketingMonthDatas.Sum(t => t.WLZJSJTRE);
                var wz1fy = NetMarketingMonthDatas.Sum(t => t.WZ2YDFY);
                if (zfy == 0) return 0;
                return wz1fy * 100 / zfy;
            }
        }

        /// <summary>
        /// 网站2费用占比
        /// </summary>
        public decimal AVG_WZ2DCZYCB
        {
            get
            {
                var fy = NetMarketingMonthDatas.Sum(t => t.WZ2YDFY);
                var zyzs = NetMarketingMonthDatas.Sum(t => t.WZ2HQXXS + t.WZ2LDS);
                if (fy == 0) return 0;
                return zyzs / fy;
            }
        }
        /**/

        /// <summary>
        /// 网站2计划发帖数
        /// </summary>
        public decimal AVG_WZ2JHFTS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2JHFTS);
            }
        }
        /// <summary>
        /// 网站2实际发帖数
        /// </summary>
        public decimal AVG_WZ2SJFTS
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2SJFTS);
            }
        }

        /// <summary>
        /// 网站2集客进度
        /// </summary>
        public decimal AVG_WZ2JKJD
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2JKJD);
            }
        }
        /// <summary>
        /// 网站2集客进度
        /// </summary>
        public decimal AVG_WZ2JKJDDiff
        {
            get
            {
                return NetMarketingMonthDatas.AverageOrDefault(t => t.WZ2JKJDDiff);
            }
        }
    }
}
